<script setup lang="ts">
import { usePrinter } from '@/utils'
import { usePrintStore } from '@/stores/print'

const { selectedPrinter, selectedParper, parperList, printList, print, getPrintList, getPrintParperList } = usePrinter();

const printStore = usePrintStore()
const testSend = () => {
  print("./grf/print-donot-asdesign.grf", "./data/DataCenter.txt")
}

</script>

<template>
  <div>
    {{ printStore.printList }}
    {{ printStore.selectedPrinter }}
    <hr>
    <button @click="getPrintList">设置打印机列表</button>
    <button @click="getPrintParperList">获取纸张列表</button>

    <span>选择打印机:</span>
    <select v-model="selectedPrinter">
      <option v-for="item in printList" :key="item" :value="item">{{ item }}</option>
    </select>
    <span>选择纸张:</span>
    <select v-model="selectedParper">
      <option v-for="item in parperList" :key="item" :value="item">{{ item }}</option>
    </select>
    <div class="line"></div>
    <button @click='testSend'>直接打印(不带预览)</button>
  </div>
</template>

<style scoped>
.line {
  width: 100%;
  height: 1px;
  background-color: #000;
}
</style>
